// 进行路由批量注册
const fs = require('fs')
module.exports = app => {
  // 同步读取某文件目录下的内容
  fs.readdirSync(__dirname).forEach(file => {
    if (file === 'index.js') { return; }
    const route = require(`./${file}`);
    app.use(route.routes()).use(route.allowedMethods())
  })
}